package com.hbut.bili.controller;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.hbut.bili.entity.Video;
import com.hbut.bili.service.VideoService;

public class VideoListServlet extends HttpServlet {
	
	private VideoService videoService = new VideoService();

	@Override
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		List<Video> videoList = new ArrayList<Video>();
		try {
			videoList = videoService.selectVideoList();
		} catch (Exception e) {
			e.printStackTrace();
		}
		request.setAttribute("videoList", videoList);
		
		request.getRequestDispatcher("view/videoList.jsp").forward(request, response);
	}
	
	
}
